# Description: Don't create an empty history file when History=0
# Author: <bdefreese@bddebian3.bddebian.com>

Index: gmrun-0.9.2/src/history.cc
===================================================================
--- gmrun-0.9.2.orig/src/history.cc	2010-02-03 12:33:29.575767540 +0800
+++ gmrun-0.9.2/src/history.cc	2010-02-03 12:34:47.349422238 +0800
@@ -65,17 +65,19 @@
   if (!configuration.get_int("History", HIST_MAX_SIZE))
     HIST_MAX_SIZE = 20;
 
-  ofstream f(filename, ios::out);
+  if (HIST_MAX_SIZE) {
+    ofstream f(filename, ios::out);
 
-  int start = 0;
-  if (history.size() > (size_t)HIST_MAX_SIZE)
-    start = history.size() - HIST_MAX_SIZE;
+    int start = 0;
+    if (history.size() > (size_t)HIST_MAX_SIZE)
+      start = history.size() - HIST_MAX_SIZE;
+
+    for (size_t i = start; i < history.size(); i++)
+      if (history[i].length() != 0)
+        f << history[i] << endl;
 
-  for (size_t i = start; i < history.size(); i++)
-    if (history[i].length() != 0)
-      f << history[i] << endl;
-
-  f.flush();
+    f.flush();
+  }
 }
 
 void
